package Demo.Interfaces;

import java.util.Comparator;

/**
 * @className: Student2
 * @author: 芃
 * @description:
 * @date: 2023/8/17 14:05
 */
class ScoreComparator implements Comparator<Student2>{

    @Override
    public int compare(Student2 o1, Student2 o2) {
        return (int) (o1.score - o2.score);
    }
}
class AgeComparator implements Comparator<Student2>{

    @Override
    public int compare(Student2 o1, Student2 o2) {
        return o1.age - o2.age;
    }
}
public class Student2 {
    public String name;
    public int age;
    public double score;

    @Override
    public String toString() {
        return "Student2{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", score=" + score +
                '}';
    }

    public Student2(String name, int age, double score) {
        this.name = name;
        this.age = age;
        this.score = score;
    }
}
